@function str-replace($string, $search, $replace: '') {
    $index: str-index($string, $search);

    @if $index {
        @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
    }

    @return $string;
}

@function admin-font-faces($fonts) {
    $url: "//fonts.googleapis.com/css?family=";
    $nb: 0;

    @each $fontname, $weights in $fonts {

        @if $fontname == $fonts-default or
            $fontname == $fonts-header or
            $fontname == $fonts-mono {

            $nb: $nb + 1;
            $nb-word: 0;

            $fontname: str-replace("#{$fontname}", " ", "+");

            $url: $url + $fontname;

            @if $weights != null {
                $url: $url + ":" + $weights;
            }

            @if $nb < 3 {
                $url: $url + "|";
            }
        }
    }

    @return $url;
}

@mixin body-fonts($font) {
    body, h5, h6,
    .badge, .note, .grav-mdeditor-preview,
    input, select, textarea, button, .selectize-input {
        font-family: "#{$font}", "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif;
    }
}

@mixin header-fonts($font) {
    h1, h2, h3, h4,
    #admin-menu li, .form-tabs > label, .label {
        font-family: "#{$font}", "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif;
    }
}

@mixin mono-fonts($font) {
    code, kbd, pre, samp,
    body .CodeMirror {
        font-family: "#{$font}", "Monaco", "Consolas", "Lucida Console", monospace !important;
    }
}
$font-url: admin-font-faces($font-definitions);

@import url("#{$font-url}");

@include body-fonts($fonts-default);

@include header-fonts($fonts-header);

@include mono-fonts($fonts-mono);





